package com.usefullc.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.usefullc.user.domain.Role;
import com.usefullc.user.domain.User;
import com.usefullc.user.param.UserRoleParam;
import io.lettuce.core.dynamic.annotation.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface UserMapper extends BaseMapper<User> {

    int updateStatus(@Param("id") Long id, @Param("status") Integer status);


//    @Query(value = "update `u_user` t set t.status = ?2,t.gmtModified=now(6) where t.id in (?1) and t.status != ?2",nativeQuery = true)
    int updateAllStatus(@Param("ids") List<Long> ids, @Param("status") Integer status);

//    @Query(value = "update `u_user` t set t.pwd = ?2,t.gmtModified=now(6) where t.id in (?1) ",nativeQuery = true)
    int updateAllPwd(@Param("ids")  List<Long> ids,@Param("pwd") String pwd);


    int insertUserRoleBatch(@Param("list") List<UserRoleParam> paramList);


    int deleteUserRoleByUserId(@Param("userId") Long userId);


    List<Role> findRoleListByUserId(@Param("userId") Long userId);

}
